package JZ33_丑数;

import java.util.TreeSet;

public class Solution {
    public int GetUglyNumber_Solution(int index) {
        TreeSet<Long> set = new TreeSet<>();
        set.add(1L);
        long num = 0;
        while (index > 0){
            num = set.pollFirst();
            set.add(num * 2);
            set.add(num * 3);
            set.add(num * 5);
            index--;
        }
        return (int)num;
    }
}
